package com.study.cloud.registry.api;

import com.study.cloud.gateway.common.rule.ServiceDefinition;
import com.study.cloud.gateway.common.rule.ServiceInstance;

/**
 * @author wangwancheng
 * @create 2025/7/19 17:02
 */
public interface RegistryCenter {
    /**
     * 初始化
     */
    void init(String registryAddress, String env);

    /**
     * 服务注册
     * @param serviceDefinition
     * @param serviceInstance
     */
    void register( ServiceDefinition serviceDefinition, ServiceInstance serviceInstance);

    /**
     * 服务注销
     * @param serviceDefinition
     * @param serviceInstance
     */
    void deRegister(ServiceDefinition serviceDefinition, ServiceInstance serviceInstance);

    /**
     * 订阅所有变化的服务
     * @param listener
     */
    void subscribeAllServices(RegisterCenterListener listener);
}
